<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/html/js/axios.min.js"></script>
    <script src="/html/js/ajax.js"></script>
    <script src="/html/js/util.js"></script>
    <link rel="stylesheet" href="index.css">
    <script>

        window.onload=function (){
            init();
        }
        async function init(){
            let info = await ajaxGet("/channel/findAll");
            let str ="";
            for (let i=0;i<info.length;i++){
                var s =info[i];
                str +=`<tr><td><a href="/html/show.html?channelId=${s.id}">${s.name}</a></td><td>${s.info}</td><td>${s.num}</td></tr>`
            }
            $("channelData").innerHTML=str;
        }
        async function findId(){
            let info = await ajaxGet("/topic/findById");
            let str ="";
            for (let i=0;i<info.length;i++){
                let  to =info[i];
                str +=`<tr><td><a href="/html/show.html?topicId=${to.id}"></td></tr>`
            }
            $("channelData").innerHTML=str;
        }
    </script>
</head>
<body>
<div id="headDiv">
    <a href="/html/mune.html">首页</a>|
    <a href="/html/login.html">登录</a>|
    <a href="/html/add.html">注册</a>|
    <a href="javascript:">管理</a>|
    <a href="javascript:">风格</a>
</div>
<div id="mainDiv">
    <div class="countDiv">
        <span>登录状态与统计</span>
    </div>
    <div id="userDiv" style=" background-color: rgb(228,237,249);" onclick="findId()"></div>
    <div id="channelDiv">
        <table border="0"  width="800px"   cellpadding="0">
            <thead class="thead">
            <tr style="height: 30px" ><th>频道名称</th><th>频道描述</th><th>主贴数量</th></tr>
            </thead>
            <tbody id="channelData"></tbody>
        </table>
    </div>
</div>
</body>
</html>